package com.nettyrpc.bean;

import net.sf.cglib.reflect.FastClass;
import net.sf.cglib.reflect.FastMethod;

public class CglibHandlerAdapter extends AbstractInvokeHandler {

    @Override
    protected Object doHandle(Class<?> clazz, Object serviceBean, String methodName, Class<?>[] parameterTypes, Object[] parameters) throws Throwable {
        FastClass fastClass = FastClass.create(clazz);
        FastMethod fastMethod = fastClass.getMethod(methodName, parameterTypes);
        return fastMethod.invoke(serviceBean, parameters);
    }

}
